#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <optional>
#include <functional>

#include "delaunay.h"



int main() {
    const int POINT_COUNT = 50000;
    std::vector<Point> points;
    points.reserve(POINT_COUNT);

    // 生成随机点
    std::random_device rd;
    std::mt19937 gen(rd());
    std::uniform_real_distribution<> dis(0.0, 1000.0);

    for (int i = 0; i < POINT_COUNT; ++i) {
        points.emplace_back(dis(gen), dis(gen));
    }

    std::cout << "生成了" << POINT_COUNT << "个随机点，开始三角剖分..." << std::endl;

    // 计时并执行三角剖分
    auto start = std::chrono::high_resolution_clock::now();
    std::vector<int> triangles = triangulate(points);
    auto end = std::chrono::high_resolution_clock::now();

    // 计算耗时
    std::chrono::duration<double, std::milli> duration = end - start;

    std::cout << "三角剖分完成，生成三角形数量: " << triangles.size() / 3 << std::endl;
    std::cout << "处理" << POINT_COUNT << "个点耗时: " << duration.count() << "ms" << std::endl;

    return 0;
}

// 不包含实现文件，而是在编译时链接